import {Button} from "antd";
import React from "react";
import {useLocation,useSearchParams} from "react-router-dom";
// function B () {
//     const location = useLocation()
//     const obj = new URLSearchParams(location.search)
//     const [objs] = useSearchParams()
//
//     // 隐式参数
//     // const obj = location.state
//
//     return  <>
//         <div>页面B</div>
//         <div>{obj.get('id')}</div>
//         <div>{objs.get('name')}</div>
//         <Button type="primary">跳转</Button>
//     </>
// }

class B extends React.Component{
    render() {
        console.log(this.props)
        let { navigate } = this.props
        const next = () => {
            navigate('/b')
        }
        return  <>
            <div>页面B</div>
            <Button type="primary" onClick={next}>跳转</Button>
        </>
    }
}

    // 隐式参数
    // const obj = location.state


export default B
